package com.dysoft.flesh;

import com.dysoft.bones.DataManager;
import org.apache.log4j.Logger;

/**
 * @author Sean Micklethwaite
 *         Aug 14, 2010 9:58:25 PM
 */
public interface Renderer {
	final static Logger LOG = Logger.getLogger(Renderer.class);

	void render(RenderContext ctx) throws DataManager.DataObject.NotPresentException;

	interface Root extends Renderer, RenderTarget {
		void queuePreRenderOp(Operation op);
	}

	interface Operation {
		boolean call(RenderContext ctx) throws Exception;
	}

	public class Profiler extends com.dysoft.bones.Profiler implements RenderComponent {
		public Profiler(String name) {
			super(name);
		}

		public void activate(RenderContext ctx) {
			begin();
		}

		public void deactivate(RenderContext ctx) {
			end();
		}

		@Override
		public String toString() {
			return getName();
		}
	}
}
